package com.kexio.email.enums;

/**
 * 邮件模板类型枚举
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
public enum TemplateType {
    
    /**
     * 欢迎邮件
     */
    WELCOME("welcome", "欢迎邮件"),
    
    /**
     * 通知邮件
     */
    NOTIFICATION("notification", "通知邮件"),
    
    /**
     * 验证邮件
     */
    VERIFICATION("verification", "验证邮件"),
    
    /**
     * 密码重置
     */
    PASSWORD_RESET("password_reset", "密码重置"),
    
    /**
     * 营销推广
     */
    PROMOTION("promotion", "营销推广"),
    
    /**
     * 系统邮件
     */
    SYSTEM("system", "系统邮件"),
    
    /**
     * 订单邮件
     */
    ORDER("order", "订单邮件"),
    
    /**
     * 账单邮件
     */
    BILLING("billing", "账单邮件"),
    
    /**
     * 报告邮件
     */
    REPORT("report", "报告邮件"),
    
    /**
     * 自定义邮件
     */
    CUSTOM("custom", "自定义邮件");
    
    private final String code;
    private final String description;
    
    TemplateType(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static TemplateType fromCode(String code) {
        for (TemplateType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown template type code: " + code);
    }
}
